/*    */ package com.zimbra.cs.dav.service.method;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.dav.DavContext;
/*    */ import com.zimbra.cs.dav.DavContext.Depth;
/*    */ import com.zimbra.cs.dav.DavElements;
/*    */ import com.zimbra.cs.dav.DavElements.CardDav;
/*    */ import com.zimbra.cs.dav.DavException;
/*    */ import com.zimbra.cs.dav.DavException.UnsupportedReport;
/*    */ import com.zimbra.cs.dav.service.DavMethod;
/*    */ import com.zimbra.cs.dav.service.DavResponse;
/*    */ import java.io.IOException;
/*    */ import java.util.HashMap;
/*    */ import org.dom4j.Document;
/*    */ import org.dom4j.Element;
/*    */ import org.dom4j.QName;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class Report
/*    */   extends DavMethod
/*    */ {
/*    */   public static final String REPORT = "REPORT";
/*    */   
/*    */   public String getName()
/*    */   {
/* 39 */     return "REPORT";
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/* 45 */   private static HashMap<QName, DavMethod> sReports = new HashMap();
/* 46 */   static { sReports.put(DavElements.E_CALENDAR_QUERY, new CalendarQuery());
/* 47 */     sReports.put(DavElements.E_CALENDAR_MULTIGET, new CalendarMultiget());
/* 48 */     sReports.put(DavElements.E_FREE_BUSY_QUERY, new FreeBusyQuery());
/* 49 */     sReports.put(DavElements.E_PRINCIPAL_PROPERTY_SEARCH, new AclReports());
/* 50 */     sReports.put(DavElements.E_ACL_PRINCIPAL_PROP_SET, new AclReports());
/* 51 */     sReports.put(DavElements.E_PRINCIPAL_MATCH, new AclReports());
/* 52 */     sReports.put(DavElements.E_PRINCIPAL_SEARCH_PROPERTY_SET, new AclReports());
/* 53 */     sReports.put(DavElements.E_EXPAND_PROPERTY, new ExpandProperty());
/* 54 */     sReports.put(DavElements.CardDav.E_ADDRESSBOOK_QUERY, new AddressbookQuery());
/* 55 */     sReports.put(DavElements.CardDav.E_ADDRESSBOOK_MULTIGET, new AddressbookMultiget());
/*    */   }
/*    */   
/*    */   public void handle(DavContext ctxt) throws DavException, IOException, ServiceException
/*    */   {
/* 60 */     if (!ctxt.hasRequestMessage()) {
/* 61 */       throw new DavException("empty request body", 400, null);
/*    */     }
/*    */     
/* 64 */     Document req = ctxt.getRequestMessage();
/* 65 */     Element top = req.getRootElement();
/* 66 */     if (top == null) {
/* 67 */       throw new DavException("empty request body", 400, null);
/*    */     }
/* 69 */     QName topName = top.getQName();
/* 70 */     DavMethod report = (DavMethod)sReports.get(topName);
/* 71 */     if (report == null) {
/* 72 */       throw new DavException.UnsupportedReport(topName);
/*    */     }
/*    */     
/* 75 */     disableJettyTimeout(ctxt);
/* 76 */     if (ctxt.getDepth() != DavContext.Depth.zero) {
/* 77 */       ctxt.getDavResponse().createResponse(ctxt);
/*    */     }
/* 79 */     report.handle(ctxt);
/* 80 */     sendResponse(ctxt);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/dav/service/method/Report.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */